package com.hongkzh.www.other.api;

/**
 * Created by asad on 2018/3/26.
 * 接口类
 */

public class Api {
    private static String IP = "https://api.hongkzh.com";
    private static String VERSION = "/v1";
    private static String API = IP + VERSION;

    private static String ADV = "/adv";
    private static String CAROUSEL = "/carousel";
    private static String USER = "/user";
    private static String MEDIAADV = "/mediaAdv";

    private static String addParameters(String loginUid, String id, String uid, String pageNumber, String followUserId) {
        UrlWrapper urlWrapper = UrlWrapper.getInstance();
        if (loginUid != null)
            urlWrapper.addParameter("loginUid", loginUid);
        if (id != null)
            urlWrapper.addParameter("id", id);
        if (uid != null)
            urlWrapper.addParameter("uid", uid);
        if (pageNumber != null)
            urlWrapper.addParameter("pageNumber", pageNumber);
        if (followUserId != null)
            urlWrapper.addParameter("followUserId", followUserId);
        return urlWrapper.getRequestURL();
    }

    private static String addMediaPara(String loginUid, String uid) {
        UrlWrapper urlWrapper = UrlWrapper.getInstance();
        if (loginUid != null) {
            urlWrapper.addParameter("loginUid", loginUid);
        }
        if (uid != null) {
            urlWrapper.addParameter("uid", uid);
        }

        return urlWrapper.getRequestURL();
    }

    private static String addMediaProPara(String uid, String pageNumber, String sortId, String sortValue) {
        UrlWrapper urlWrapper = UrlWrapper.getInstance();
        if (uid != null) {
            urlWrapper.addParameter("uid", uid);
        }
        if (pageNumber != null) {
            urlWrapper.addParameter("pageNumber", pageNumber);
        }
        if (sortId != null) {
            urlWrapper.addParameter("sortId", sortId);
        }
        if (sortValue != null) {
            urlWrapper.addParameter("sortValue", sortValue);
        }

        return urlWrapper.getRequestURL();
    }

    //用户接口curl -X POST "https://api.hongkzh.com/v1/user/findDayIntegral?loginId=1" -H "accept: application/json"
    //当日收益
    public static String FINDDAYINTEGRAL(String loginUid) {
        return API + USER + "/findDayIntegral" + addParameters(loginUid, null, null, null, null);
    }

    //关注
    public static String FOLLOWADD(String uid, String followUserId) {
        return API + USER + "/followAdd" + addParameters(null, null, uid, null, followUserId);
    }

    //取消关注
    public static String FOLLOWDELETE(String uid, String id) {
        return API + USER + "/followDelete" + addParameters(null, id, uid, null, null);
    }

    //关注列表
    public static String FOLLOWLIST(String id, String pageNumber) {
        return API + USER + "/followList" + addParameters(null, id, null, pageNumber, null);
    }

    //历史记录
    public static String HISTORYLIST(String id, String pageNumber) {
        return API + USER + "/historyList" + addParameters(null, id, null, pageNumber, null);
    }

    //乐看主页轮播
    //轮播图
    public static String GETCAROUSELLIST = API + CAROUSEL + "/getCarouselList";
    //主页分类
    public static String GETCATEGORYLIST = API + CAROUSEL + "/getCategoryList";
    //乐看主页广告
    //推荐广告
    public static String GETRECOMMENDLIST = API + ADV + "/getRecommendList";
    //静态广告
    public static String GETSTATICLIST = API + ADV + "/getStaticList";
    //企业广告
    public static String GETENTERPRISELIST = API + ADV + "/getEnterpriseList";
    //自媒体广告
    public static String GETMEDIALIST = API + ADV + "/getMediaList";
    //城市列表
    public static String GETCITYLIST = API + ADV + "/getCityList";
    //城市广告
    public static String GETCITYADVLIST = API + ADV + "/getCityAdvList";
    //传统广告
    public static String GETTRADITIONLIST = API + ADV + "/getTraditionList";

    //人气分页
    public static String GETHOTADVLIST(String pageNumber) {
        return API + ADV + "/getHotAdvList" + addParameters(null, null, null, pageNumber, null);
    }

    //视频详情
    //视频信息
    public static String GETADVBYID(String id) {
        return API + ADV + "/getAdvById" + addParameters(null, id, null, null, null);
    }

    //视频评论信息
    public static String GETADVCOMMENTSBYID(String id, String pageNumber) {
        return API + ADV + "/getAdvCommentsById" + addParameters(null, id, null, pageNumber, null);
    }

    // 获取企业信息
    public static String GETUSERInfo(String loginUid, String compId) {
        return API + USER + "/getUserInfo" + addMediaPara(loginUid, compId);
    }

    // 获取媒体产品的列表
    public static String GETALLProductBYUSERID(String uid, String pageNumber, String sortId, String sortValue) {
        return API + USER + "/getAllProductByUserId" + addMediaProPara(uid, pageNumber, sortId, sortValue);
    }

    // 获取自媒体图集的列表
    public static String GETALLALBUMBYUSERID(String uid, String pageNumber, String sortId, String sortValue) {
        return API + USER + "/getAllAlbumByUserId" + addMediaProPara(uid, pageNumber, sortId, sortValue);
    }

    // 获取自媒体视频的列表
    public static String GETUSERADVLIST(String uid, String pageNumber, String sortId, String sortValue) {
        return API + USER + "/getUserAdvList" + addMediaProPara(uid, pageNumber, sortId, sortValue);
    }

    // 添加关注
    public static String FOLLOWADD = API + USER + "/followAdd";
    // 取消关注
    public static String FOLLOWDELETE = API + USER + "/followDelete";
    // 获取我的关注列表
    public static String FOLLOWLIST = API + USER + "/followList";
    //获取我的历史观看列表
    public static String HISTORYLIST = API + USER + "/historyList";
    //删除历史观看记录
    public static String HISTORYDELETE = API + USER + "/historyDelete";

    // 获取相关推荐信息
    public static String GETADVRECOMMENDBYADVID(String id) {
        return API + ADV + "/getAdvRecommendByAdvId" + addParameters(null, id, null, null, null);
    }

    //自媒体广告
    //自媒体主页轮播图列表
    public static String GETCAROUSELLISTMEDIAADV = API + MEDIAADV + "/getCarouselList";
    //获取自媒体主页top10列表
    public static String GETTOP10LIST = API + MEDIAADV + "/getTop10List";

    //通过当前登录用户id 获取分类信息
    public static String USERCATEGORYLIST(String loginUid) {
        return API + MEDIAADV + "/userCategoryList" + addParameters(loginUid, null, null, null, null);
    }

    //人气分页
    public static String GETHOTADVLISTMEDIAADV(String pageNumber) {
        return API + MEDIAADV + "/getHotAdvList" + addParameters(null, null, null, pageNumber, null);
    }
}
